package cn.yitun.chat.yitunservercommonlib.constant;

/**
 * 服务器参数
 * @author yitun
 * @date 2019-01-16 11:42:49
 */
public class ServerConstant {

	/**
	 * 协议类型
	 * @author yitun
	 * @date 2019-01-16 11:49:56
	 */
	public enum Protocol {

		TCP("TCP"), UDP("UDP"), HTTP("HTTP"), HTTPS("HTTPS"), WebSocket("WebSocket"), FTP("FTP");

		private String value;

		private Protocol(String value) {
			this.value = value;
		}

		public String value() {
			return this.value;
		}
	}

	/**
	 * 地址类型
	 * @author yitun
	 * @date 2019-01-16 11:50:07
	 */
	public enum AddressType {

		IPv4("IPv4"), IPv6("IPv6"), URL("URL");

		private String value;

		private AddressType(String value) {
			this.value = value;
		}

		public String value() {
			return this.value;
		}
	}

	/**
	 * 服务类型
	 * @author yitun
	 * @date 2019-01-16 11:51:28
	 */
	public enum ServerType {

		main("main"), api("api"), file("file"), video("video"), voice("voice"), mode("mode"), proxy("proxy");

		private String value;

		private ServerType(String value) {
			this.value = value;
		}

		public String value() {
			return this.value;
		}
	}

	/**
	 * 服务器是否代理，本地与有nginx等代理的区别
	 * @author yitun
	 * @date 2019-01-16 11:51:28
	 */
	public enum ServerMode {

		DEV("dev"), PRO("pro"),
		;

		private String value;

		private ServerMode(String value) {
			this.value = value;
		}

		public String value() {
			return this.value;
		}
	}

	/**
	 * 服务地址，端口
	 * 与ServerProperties对应，配置文件config.yml
	 * @author yitun
	 * @date 2019-01-16 11:51:28
	 */
	public enum ServerAddressOrPort {

		/************************ category start ********************* */
		//category
		CATEGORY_CONFIG_BASE("server.config.base","config.base"),
		CATEGORY_CONFIG_PROXY("server.config.proxy","config.proxy"),
		CATEGORY_CONFIG_CHAT("server.config.chat","config.chat"),
		CATEGORY_CONFIG_FILE("server.config.file","config.file"),
		CATEGORY_PATH_BASE("server.path.base","path.file"),
		CATEGORY_PATH_MAIN("server.path.main","path.file"),
		CATEGORY_PATH_API("server.path.api","path.api"),
		CATEGORY_PATH_CHAT("server.path.chat","path.chat"),
		CATEGORY_PATH_FILE("server.path.file","path.file"),
		CATEGORY_PATH_REMOTE("server.path.remote","path.remote"),

		/************************ category end ********************* */


		/************************ server start ********************* */
		//server
		SERVER_MODE("yitun.mode", "服务器部署profile类型"),
		SERVER_PORT("server.port", "服务端口配置"),
		SERVER_PROXY("server.proxy", "服务端口配置代理服务名"),
		SERVER_CONFIG_ENABLED("server.config.enabled", "是否可用"),
		SERVER_CONFIG_ADDRESS("server.config.address", "聊天服务的地址"),
		SERVER_CONFIG_CHAT_TCP_PORT("server.config.chat.tcp.port", "聊天服务的tcp port"),
		SERVER_CONFIG_CHAT_TCP_PROXY("server.config.chat.tcp.proxy", "聊天服务的tcp port代理服务名"),
		SERVER_CONFIG_CHAT_UDP_PORT("server.config.chat.udp.port", "聊天服务的udp port"),
		SERVER_CONFIG_CHAT_UDP_PROXY("server.config.chat.udp.proxy", "聊天服务的udp port代理服务名"),
		SERVER_CONFIG_CHAT_WEBSOCKET_PORT("server.config.chat.websocket.port", "聊天服务的websocket port"),
		SERVER_CONFIG_CHAT_WEBSOCKET_PROXY("server.config.chat.websocket.proxy", "聊天服务的websocket port代理服务名"),
		SERVER_CONFIG_CHAT_WEBSOCKET_PATH("server.config.chat.websocket.path", "聊天服务的websocket port"),
		SERVER_CONFIG_FILE_UPLOAD_PATH("server.config.file.upload.path", "文件服务相关配置category=server.config.file,文件保存在服务器的路径"),
		SERVER_CONFIG_FILE_REQUEST_PATH("server.config.file.request.path", "访问本文件系统的地址"),
		SERVER_CONFIG_REMOTE_TCP_PORT("server.config.remote.tcp.port", "远程服务相关配置category=server.config.remote"),
		SERVER_CONFIG_REMOTE_TCP_PROXY("server.config.remote.tcp.proxy", "远程服务相关配置category=server.config.remote代理服务名"),

		SERVER_MAIN_TCP_ADDRESS("server.main.tcp.address", "socket服务地址"),
		SERVER_MAIN_TCP_PORT("server.main.tcp.port", "socket服务端口"),
		SERVER_MAIN_WEBSOCKET_ADDRESS("server.main.websocket.address", "ws服务地址"),
		SERVER_MAIN_WEBSOCKET_PORT("server.main.websocket.port", "ws服务端口"),
		SERVER_MAIN_WEBSOCKET_SUFFIX("server.main.websocket.address", "ws服务后缀"),
		SERVER_MAIN_HTTP_ADDRESS("server.main.http.address", "服务地址"),
		SERVER_MAIN_HTTP_PORT("server.main.http.port", "服务端口"),
		SERVER_API_HTTP_ADDRESS("server.api.http.address", "服务地址"),
		SERVER_API_HTTP_PORT("server.api.http.port", "服务端口"),
		SERVER_FILE_HTTP_ADDRESS("server.file.http.address", "服务地址"),
		SERVER_FILE_HTTP_PORT("server.file.http.port", "服务端口"),

		/************************ server start ********************* */


		/************************ path start ********************* */
//
		SERVER_ADDRESS("server.address", "这个地址是此项目运行的服务器地址，就是其他电脑可以访问此服务的IP地址,当为空的时候，系统自动获取此电脑IP，可能会不对，所以建议配置"),
		CHAT_SERVER_TCP_ADDRESS("chat.server.tcp.address", "聊天服务的tcp端口，不配置的话取默认配置，如果对外使用了负载均衡或者路由端口映射等，并且端口不一致的话，需要配置可访问端口，例如服务器使用12010端口，路由使用2000端口映射,那么需要配置2000"),
		CHAT_SERVER_TCP_PORT("chat.server.tcp.port", "聊天服务的tcp端口，不配置的话取默认配置，如果对外使用了负载均衡或者路由端口映射等，并且端口不一致的话，需要配置可访问端口，例如服务器使用12010端口，路由使用2000端口映射,那么需要配置2000"),
		CHAT_SERVER_UDP_ADDRESS("chat.server.udp.address", "聊天服务的udp地址(就是可以访问本访问的地址)暂时用不上"),
		CHAT_SERVER_UDP_PORT("chat.server.udp.port", "聊天服务的udp端口"),
		CHAT_SERVER_WEBSOCKET_ADDRESS("chat.server.websocket.address", "聊天服务的webSocket路径"),
		CHAT_SERVER_WEBSOCKET_PORT("chat.server.websocket.port", "聊天服务的webSocket端口"),
		CHAT_SERVER_WEBSOCKET_SUFFIX("chat.server.websocket.suffix", "聊天服务的webSocket路由后缀"),
		CHAT_SERVER_HTTP_ADDRESS("chat.server.http.address", "聊天服务的http地址"),
		CHAT_SERVER_HTTP_PORT("chat.server.http.port", "聊天服务的http端口"),
		CHAT_SERVER_REMOTE_TCP_ADDRESS("chat.server.remote.tcp.address", "远程协助服务地址"),
		CHAT_SERVER_REMOTE_TCP_PORT("chat.server.remote.tcp.port", "远程协助服务端口"),
		CHAT_SERVER_FILE_HTTP_ADDRESS("chat.server.file.http.address", "文件服务地址（同tcp端口配置说明）"),
		CHAT_SERVER_FILE_HTTP_PORT("chat.server.file.http.port", "文件服务端口（同tcp端口配置说明）"),
		CHAT_SERVER_API_HTTP_ADDRESS("chat.server.api.http.address", "api服务地址"),
		CHAT_SERVER_API_HTTP_PORT("chat.server.api.http.port", "api服务端口"),

		/************************ path end ********************* */

        ;

		private String value;

		private String memo;

		private ServerAddressOrPort(String value, String memo) {
			this.value = value;
			this.memo = memo;
		}

		public String value() {
			return this.value;
		}

		public String getMemo() {
			return this.memo;
		}
	}
}
